package com.javaGame.test;

public class Man {
    private Plane p = new Plane();
    private Ship s = new Ship();

    public void fly(){
        p.fly();
    }
    public void swim(){
        s.swim();
    }

    //用父类变量做参数可以传递任何一个子类对象
    //用接口变量做参数可以传递任何一个实现类对象
    public void hid(Horse h){

    }

    public static void main(String[] args) {
//        Horse h = new BlackHorse();
//        h = new WhiteHorse();
        Man m = new Man();
        m.hid(new WhiteHorse());
        m.hid(new BlackHorse());
    }
}
class Horse{

}
class WhiteHorse extends Horse{

}
class BlackHorse extends Horse{

}


class Bird {
    public void fly(){

    }
}
class Fish{
    public void swim(){

    }
}

class Plane{
    public void fly(){

    }
}
class Ship{
    public void swim(){

    }
}